package com.hooya.fa.eu.biz.controller;

import com.hooya.fa.eu.api.enums.CkEnum;
import com.hooya.fa.eu.biz.service.TempService;
import com.hooya.integrated.common.core.util.R;
import com.hooya.integrated.common.security.annotation.Inner;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * @Description 1
 * @Author : Zongz
 * @Copyright Copyright (c) 豪雅集团
 * @Create 2024/1/31
 * @Version 1.0.0
 */
@RestController
@RequiredArgsConstructor
@Tag(name = "临时")
@RequestMapping("/temp")
public class TempController {

    private final TempService tempService;

    @PostMapping("/goods")
    @Inner(value = false)
    public R<Void> deleteDistinctData() {
        tempService.deleteDistinctData();
        return R.ok();
    }

    @PostMapping("/goods/sheet")
    @Inner(value = false)
    public R<Void> deleteDistinctSheetData() {
        tempService.deleteDistinctSheetData();
        return R.ok();
    }

    @GetMapping("/cache/dict")
    @Inner(value = false)
    public R<Void> getDict() {
        tempService.getDict(CkEnum.FBA_CK_MAP.getName());
        return R.ok();
    }

    @GetMapping("/dict")
    @Inner(value = false)
    public R<Void> getCacheDict() {
        tempService.getCacheDict();
        return R.ok();
    }

    /**
     * EU07 迁移
     *
     * @return
     */
    @PostMapping("/migration")
    @Inner(value = false)
    public R<Void> warehouseMigration(@RequestParam("startDate") String startDate,
                                      @RequestParam("endDate") String endDate) {
        tempService.warehouseMigration(startDate, endDate);
        return R.ok();
    }

    /**
     * EU07 迁移纠正
     *
     * @return
     */
    @PutMapping("/migration")
    @Inner(value = false)
    public R<Void> warehouseMigrationRectify() {
        tempService.warehouseMigrationRectify();
        return R.ok();
    }

    /**
     * wms库位补充
     */
    @PostMapping("/position/supplement")
    @Inner(value = false)
    public R<Void> positionSupplement() {
        tempService.positionSupplement();
        return R.ok();
    }

    /**
     * 拉平仓库
     */
    @PostMapping("/evenUp")
    @Inner(value = false)
    public R<Void> evenUp(@RequestParam("date") String date) {
        tempService.evenUp(date);
        return R.ok();
    }


    /**
     * 3.31 盘亏盘盈 仓库 （'EU01', 'EU06', 'EU115', 'EU116', 'EU97', "EU生资库"） 所有数据
     */
    @PostMapping("/evenUpPlace")
    @Inner(value = false)
    public R<Void> evenUpPlace(@RequestParam("date") String date) {
        tempService.evenUpPlace(date);
        return R.ok();
    }

    @PostMapping("/suppl/jpk")
    @Inner(value = false)
    @Operation(summary = "补充jpk全年盘点数据", description = "补充因stock list 12月份缺失全年盘点数据的jpk数据", hidden = true)
    public R<Void> supplJpk() {
        tempService.supplJpk();
        return R.ok();
    }

    @PostMapping("/suppl/pk/info")
    @Inner(value = false)
    @Operation(summary = "补充jpk全年盘点数据", description = "补充因stock list 12月份缺失全年盘点数据的jpk数据", hidden = true)
    public R<Void> supplPkInfo() {
        tempService.readProfitAndSupplPkPrice();
        return R.ok();
    }

}
